<template>
	<view>
		<u-tabbar :value="index" @change="changeTabBar" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true">
			<u-tabbar-item v-for="(item ,index) in list" :text="item.text" :icon="item.icon" :key="index">
			</u-tabbar-item>

		</u-tabbar>



	</view>
</template>

<script>
	export default {
		props: ["customTabBar"],
		data() {
			return {

				list: [{
						"text": "首页",
						"pagePath": "/pages/index/index",
						"icon": "home"
					},
					{
						"text": "专题",
						"pagePath": "/pages/topic/topic",
						"icon": "bookmark"
					},
					{
						"text": "分类",
						"pagePath": "/pages/category/category",
						"icon": "grid"
					},
					{
						"text": "购物车",
						"pagePath": "/pages/cart/cart",
						"icon": "shopping-cart"
					},
					{
						"text": "我的",
						"pagePath": "/pages/user/user",
						"icon": "account"
					}
				]
			}
		},
		computed: {

			index() {
				return this.$store.state.tabBarIndex
			}
		},
		methods: {
			changeTabBar(index) {
				uni.switchTab({
					url: this.list[index].pagePath
				})
			}
		}
	}
</script>

<style>

</style>
